import { useState } from "react";

function EventBus({ children }) {
  const [event] = useState(null);

  const callHandler = (handler: any) => {
    if (handler) {
      handler();
    }
  };



  return (
    <div>
      {children((handler: any) => (
        <div onClick={() => callHandler(handler)}>{event}</div>
      ))}
    </div>
  );
}

export default EventBus;